<?php
/*
 * Created on 2010-9-24
 * @ Author Kevin
 * @ ShangHai
 * 
 */
 Yii::import('zii.widgets.CPortlet');
class CommentList extends CPortlet{
	public $num; //显示排行条数
	
	public function init(){
		parent::init();
		}
		
	public function renderContent(){
		$UrComment = UrComment::model()->findAll(array(
			'order'=>'create_datetime desc',
			'limit'=>$this->num
		));
	//var_dump($UrBookLib[0]->book);
	$html='';
	$html.="<div class='title'><h2 class='green'>最新评论</h2></div>";
	$html.="<ul class='collectionlist'>";
	foreach($UrComment as $key=>$comment){
	$no = $key+1;
	if($no<4) $class='red'; else $class='';
	$html.="<li><span class=$class>$no . </span>$comment->subject</li>";
	}
	$html.="</ul>";
	echo $html;	
	}
}
?>
